<template>
  <div class="header-admin-fixed">
    <div class="header">
      <div class="carboncarbon">
        <h1 style="font-style: oblique;">北京林业大学碳排放核算与管理系统</h1>
      </div>
      <div class="carbonrightright">
        <el-dropdown @command="handleCommand" menu-align='start' class="float-right">
          <span class="user-img-icon">
            <i class="el-icon-user-solid" style="font-size: 30px; display: block;"></i>
            <!-- <img src="../assets/user.jpg" class="avator-img"> -->
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="signout">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AdminHeader',
  methods: {
    async handleCommand(command) {
      if (command == 'signout') {
        localStorage.removeItem("token")
        localStorage.removeItem("userId")
        localStorage.removeItem("auth")
        this.$message.success('退出登录成功')
        this.$router.push({ path: '/Login' })
      } else if (command == 'backtoindex') {
        this.$router.push({ path: '/TanHome/ManageEnergy' })
      }
    }
  }
}
</script>

<style>
.carboncarbon,
.carbonrightright {
  display: inline-block;
}

.carbonrightright {
  float: right;
  margin-top: 12px;
  vertical-align: top;
}

.carboncarbon {
  margin-left: 100px;
}

.user-img-icon {
  color: steelblue;
  width: 30px;
  height: 30px;
  opacity: 0.84;
  cursor: pointer;
  font-size: 48px;
  display: block;
  margin-right: 50px;
  margin-top: 15px;
  background-color: #FFFFFF;
  border-radius: 24px;
  padding: 4px;
}

.system-name-title {
  font-style: oblique;
  height: 24px;
  font-size: 24px;
  font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
  font-weight: bold;
  color: #FFFFFF;
  line-height: 24px;
  display: inline-block;
  margin-left: 100px;
  margin-top: 18px;
}

.header-admin-fixed {
  position: fixed;
  text-align: left;
  width: 100%;
  height: 80px;
  z-index: 100;
  top: 0;
  background: steelblue;
  min-width: 1000px;
  /* color: rgb(255, 255, 255);
  font-weight: 400;
  background-color: #95d68f;
  line-height: 60px;
  width: 96%;
  left: 0;
  text-align: left;
  padding: 0 2%; */
}</style>
